namespace FluentValidation.Internal {
    using System;

    public class PropertyModel<T, TProperty> {

        public PropertyModel(string identifier, Func<T, TProperty> propertyFunc)
        {
            Identifier = identifier;
            PropertyFunc = propertyFunc;
            OnFailure = x => { };
        }

        //public string Identifier { get; private set; }
        public Func<T, TProperty> PropertyFunc { get; private set; }
        public string CustomPropertyName { get; set; }
        public Action<T> OnFailure { get; set; }

        /// <summary>
        /// Returns the property name for the property being validated.
        /// Returns null if it is not a property being validated (eg a method call)
        /// </summary>
        public string Identifier { get; set; }


        public string PropertyDescription {
            get { return CustomPropertyName ?? Identifier.SplitPascalCase(); }
        }
    }
}